/*
 * Jamus
 * Copyright (C) 2010 Jamus Team
 *
 * Jamus is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Jamus is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Jamus.  If not, see <http://www.gnu.org/licenses/>.
 */

/*
 * Plugin.h
 * amarok plugin
 *  Created on: Dec 29, 2009
 *      Author: christian moellinger
 */

#ifndef AMAROK_PLUGIN_H_
#define AMAROK_PLUGIN_H_
#include <QtDBus>
#include <QDBusReply>
#include <string>
#include <iostream>
#include <boost/asio.hpp>
#include <log4cxx/logger.h>

#include "../Plugin.h"

namespace backend
{
namespace amarok
{

class Plugin: public backend::Plugin, private boost::noncopyable
{
public:
	Plugin();
	virtual ~Plugin();

	virtual void run();
	virtual void cancel();

	//void sendPlaybackStatusChanged();

	// Playback
	virtual PlaybackStatus getPlaybackStatus();
	virtual void play();
	virtual void play(int track);
	virtual void playPause();
	virtual void pause();
	virtual void stop();
	virtual int getCurrentTrack();
	virtual boost::posix_time::time_duration getElapsed();
	virtual void seek(const boost::posix_time::time_duration& pos);

	virtual void nextTrack();
	virtual void prevTrack();

	// Mixer
	virtual int getVolume();
	virtual void setVolume(int vol);
	
	// Music library
	virtual const TrackList& getTrackList();
	
	// Current playlist
	virtual const Playlist& getPlaylist();
	virtual void addToPlaylist(const std::string& fileName);
	virtual void removeFromPlaylist(int index);
	virtual void clearPlaylist();

private:
	QDBusMessage callMethod(const QString path,const QString interface,const QString method, const QList<QVariant> arguments);
	static log4cxx::LoggerPtr logger;
	TrackList tracklist;
	bool finished;
};

} // namespace mpd
} // namespace backend

#endif /* PLUGIN_H_ */
